#include <stdio.h>
#include <string.h>

int main() {
    char correct_username[] = "111";
    char correct_password[] = "111";
    char input_username[20];
    char input_password[20];
    int attempts = 3;

    while (attempts > 0) {
        printf("请输入用户名：");
        scanf("%s", input_username);
        printf("请输入密码：");
        scanf("%s", input_password);

        if (strcmp(input_username, correct_username) == 0 && strcmp(input_password, correct_password) == 0) {
            printf("登录成功！");
            break;
        } else {
            attempts--;
            if (attempts > 0) {
                printf("用户名或密码错误，您还有%d次尝试机会。", attempts);
            } else {
                printf("用户名或密码错误，您已达到最大尝试次数，程序退出。");
            }
        }
    }

    return 0;
}
